import React from 'react';
import {Route, Switch, Redirect} from 'react-router-dom'
import Index from '../pages/index'

import OrderDetail from '../pages/order/detail/index'
import OrderEvaluate from '../pages/order/evaluate/index'
import Coupon from '../pages/me/coupon/index'
import Collect from '../pages/me/collect/index'
import Browse from '../pages/me/browse/index'
import AddrManage from '../pages/me/address/manage'
import AddrList from '../pages/me/address/list'
import GoodsIndex from '../pages/goods/index'
import OrderList from '../pages/order/index'
import OrderEnsure from '../pages/order/ensure'
import Pay from '../pages/pay'
import PaySuccess from '../pages/pay/success.jsx'
import Demo from '../pages/demo'


const Blank = () => {

    if (!sessionStorage.getItem('token')) {
        return <Redirect to="/auth/login"/>
    }
    return (
        <Switch>
            <Route path={`/demo`} component={Demo}/>
            <Route path={`/index`} component={Index}/>
            <Route path={`/order/detail`} component={OrderDetail}/>
            <Route path={`/order/evaluate`} component={OrderEvaluate}/>
            <Route path={`/me/coupon`} component={Coupon}/>
            <Route path={`/me/collect`} component={Collect}/>
            <Route path={`/me/browse`} component={Browse}/>
            <Route path={`/me/addr/list`} component={AddrList}/>
            <Route path={`/me/addr/manage/:addrId`} component={AddrManage}/>
            <Route path={`/goods/index/:productId`} component={GoodsIndex}/>
            <Route path={`/order/list`} component={OrderList}/>
            <Route path={`/order/ensure`} component={OrderEnsure}/>
            <Route path={`/pay/success`} exact component={PaySuccess}/>
            <Route path={`/pay`} component={Pay}/>


        </Switch>
    );
};

export default Blank
